/*statement_print.vm and report_body_statement.vm files in */

//sets the input value in the paging forms for submitting    
function setCellInput( element1,  element2, status){        
	element1.value=status;       
	element2.value=status;   
 } 


 
 function selectAll(colId, status)    {     
	 form = document.form_checkAll;      
	 form.checkAll_colId.value=colId;    
	 form.checkAll_status.value = status;    
	 form.submit();  
 }  

 function getLink(url) { 	
	 var selectedValue = document.getElementById("reportPeriodStart").value;	
	 var nextValue = selectedValue - getDifference();	
	 location.href = url+nextValue;    
 }    

 function getDifference() { 
 var selectValue = document.getElementById("reportPeriodStart").value; 
 var temp=selectValue; 
 for(i=0;i<document.getElementById("reportPeriodStart").length;i++) 
 { 	    
	temp = document.getElementById("reportPeriodStart").options[i].value; 	    
	if(selectValue==temp){ 	   
		if(i < document.getElementById("reportPeriodStart").length-1){
			temp = document.getElementById("reportPeriodStart").options[i+1].value; 
			if(temp < selectValue){
				return selectValue-temp;
			}
			else if(i>0){
				temp = document.getElementById("reportPeriodStart").options[i-1].value; 
				if(temp < selectValue){
					return selectValue-temp;
				}
			}
		}
		break;  
	} 	   
 } 
 return 0;
 }    
 function validatePreviousLink(){    	
	 var selectValue = document.getElementById("reportPeriodStart").value;
	 var temp=selectValue;	
	 for(i=0;i<document.getElementById("reportPeriodStart").length;i++) {	
		 var temp1 = document.getElementById("reportPeriodStart").options[i].value;		
		 if(i==0){			
			temp=temp1;			
		 }
		 else{			
			 if(temp>temp1){			
				temp=temp1		
			 }		
		 }       		       	
	 }	
	 if(selectValue==temp){		
		 document.getElementById("href_id").disabled=true;	
		 document.getElementById("href_id").href = 'javascript:;';		
		 document.getElementById("href_id").onclick = '';       		
	 }	
	 else{		
	 }   
	 return true; 
 }